#!/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin 

show_version()
{
	echo "vint v1.0"
}


program_dir=vint
if [ ! -d ~/$program_dir ]
then
	mkdir ~/$program_dir
fi



rando()
{
    min=$1
    max=$(($2-$min+1))
    num=$(date +%s%N)
    echo $(($num%$max+$min))
}
num_str=`ls ~/$program_dir/ | wc -l`
num=`expr $num_str`


#for i in $(seq 1 100);do
#    index=$(rando 1 10000)
#done

target=$(rando 1 ${num})
#echo $target
  
index=0  
for file in `ls ~/$program_dir/`  
do  
    index=`expr $index + 1`  
    if [ $target -eq $index ];then
       # echo $file
        break
    fi
done  
picture_uri=/home/`whoami`/$program_dir/$file

gsettings set org.gnome.desktop.background picture-uri file://$picture_uri
notify-send -i /usr/share/icons/vint.jpg "Congratulations!" "背景图片更换了!"


